# 定义一个水果类, 创建苹果对象, 橘子对象, 西瓜对象并分别添加属性: 颜色和价格
class Fruit(object):
    def __init__(self, name, color, price):
        self.name = name
        self.color = color
        self.price = price

    def __str__(self):
        return f"{self.name}:颜色{self.color},价格{self.price}元"


apple = Fruit("苹果", "红色", 5.0)
print(apple)
orange = Fruit("橘子", "黄色", 3.0)
print(orange)
watermelon = Fruit("西瓜", "绿色", 2.0)
print(watermelon)
